package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

/**
 * 使用当前类测试反射机制
 */
@AutoRunClass
public class Person {

    private String name = "张三";
    private int age = 22;

    public Person(){}

    public Person(String name) {
        this.name = name;
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    @AutoRunMethod
    public void sayHello(){
        System.out.println(name+"Hello");
    }
    @AutoRunMethod
    public void sayHi(){
        System.out.println(name+"Hi");
    }

    public void doSome(){
        System.out.println(name+"doSome");
    }
    public void sleep(){
        System.out.println(name+"sleep");
    }
    @AutoRunMethod
    public void watchTv(){
        System.out.println(name+"watchTv");
    }
    public void study(){
        System.out.println(name+"studying...");
    }
    @AutoRunMethod
    public void playGame(){
        System.out.println(name+"playGame");
    }
    public void sing(){
        System.out.println(name+"sing...");
    }
    public void say(String info){
        System.out.println(name+":"+info);
    }
    public void say(String info,int count){
        for(int i=0;i<count;i++)
            System.out.println(name+":"+info);
    }
    private void hehe(){
        System.out.println("我是私有方法hehe");
    }

    @Override

    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}







